﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using QuDao;
using FineUICore;
using Kalman;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace AdminUI.Pages.SysManage
{
    public partial class MenuAddModel : BaseModel
    {
        public int MenuType { get; set; }

        public void OnGet(int menuType)
        {
            var nodeId = Request.Query["nodeId"];
            var nodeText = Request.Query["nodeText"];
            ViewBag.MenuSelectedText = $"{nodeId}-{nodeText}";
            ViewBag.MenuSelectedValue = nodeId;

            MenuType = menuType;
        }

        public IActionResult OnPostBtnSubmit_Click(MenuDto dto)
        {
            var id = MenuBO.Instance.Add(dto);
            LogAction(ActionType.新增, $"新增菜单：{id}-{dto.MenuName}");

            //FineUICore.PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
            ActiveWindow.HidePostBack();
            return UIHelper.Result();
        }



    }
}
